home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / exampleCode / games / IndiZone / gold / pebClass.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  5.9 KB  |  181 lines

  1. /*
  2.  * The original copyright owners of the accompanying source code files have
  3.  * agreed to place such code into the public domain.  Accordingly, anyone
  4.  * who receives or obtains a copy of such source code is freely entitled to
  5.  * reproduce, use and otherwise exploit such code (including the right to
  6.  * make derivative works), at his/her own risk and expense, without any
  7.  * obligation or liability to the original copyright owners.
  8.  *
  9.  * We would appreciate (but do not require) that the following message be
  10.  * included in any derivative works:
  11.  *
  12.  * "Portions of this program were developed by Peter Broadwell, Rob Myers
  13.  * and Robin Schaufler while working in Silicon Valley."
  14.  *
  15.  * The accompanying source code files and related documentation materials
  16.  * are distributed on an "AS IS" basis, without any warranties or
  17.  * guarantees of any kind.  All implied warranties, including the implied
  18.  * warranties of merchantability and of fitness for any particular purpose,
  19.  * are expressly disclaimed.
  20.  */
  21. #include "gl.h"
  22. #include "geom.h"
  23. #include "selectors.h"
  24. #include "class.h"
  25. #include "classIds.h"
  26. #include "mbox.h"
  27. #include "individual.h"
  28. #include "behavior.h"
  29. #include "doers.h"
  30.  
  31. #include "pebbles.h"
  32. #include "colors.h"
  33.  
  34. extern class indivClass;
  35. model mica, granite, phosphorous, magnesium, calcium;
  36. extern char *floorinit();
  37.  
  38. fcnTable pebbleTable[] = {
  39.     INIT,    floorinit,
  40.     EOTABLE,
  41. };
  42.  
  43. class pebbleClass = {
  44.     &indivClass,
  45.     pebbleTable,
  46.     sizeof(pebbles),
  47.     PEBBLES,
  48. };
  49.  
  50. pebbles pebbleTemplate = {
  51.             /*   inst        */
  52.     &pebbleClass,    /* myClass pointer    */
  53.     NULL,        /* classFunctions     */
  54.     0,            /* nFunctions        */
  55.             /*   mailbox        */
  56.     NULL,        /* subscribers          */
  57.     NULL,        /* subscribedTo         */
  58.             /*   individual        */
  59.     {000,000,-5000},    /* position        */
  60.     {0,0,0},        /* lastPosition        */
  61.     {1,0,0},        /* delta        */
  62.     {0,0,0},        /* velocity        */
  63.     {0,0,0},        /* avelocity        */
  64.     {0,0,0},        /* acceleration        */
  65.     1.0,        /* speed        */
  66.     {0,0,10},        /* heading        */
  67.     {0,900,0},        /* rotation        */
  68.     {0,0,0},        /* influence        */
  69.     1.0,        /* scale                */
  70.     &mica,        /* model        */
  71.     NULL,        /* flags        */
  72.     NULL,        /* curVars        */
  73.     NULL,        /* controls        */
  74.             /*    pebble        */
  75.     {0,0,0},        /* floor */
  76. };
  77.  
  78. point pebblePoints[] = {
  79.     {    0,     0,  0, },    /* gratuitous vertex 0 */
  80.     {   50,   100, 00, },
  81.     {  100,   -50, 00, },
  82.     {  -50,  -150, 00, },
  83.     { -150,  -100, 00, },
  84.     { -100,    50, 00, },
  85. };
  86. long pebbleVertices[] = {
  87.     5,4,3,2,1,0,
  88.     0,
  89. };
  90.  
  91.  
  92. model calcium = {
  93.     NULL,            /* next model segment          */
  94.     NULL,            /* child model segments        */
  95.     NULL,            /* geometry compiled yet?      */
  96.     (Object)&calcium,        /* compiled geometry object Id */
  97.     pebblePoints,        /* point dictionary            */
  98.     pebbleVertices,        /* polygon descriptions        */
  99.     {0,0,0},            /* centroid                */
  100.     CALCIUM_COLOR,        /* color                       */
  101.     PEBBLE_TEXTURE,        /* texture                     */
  102.     FALSE,            /* outlined                    */
  103.     {0,0,0},            /* rotation                    */
  104.     {-200,200,0},        /* translate                */
  105.     {0.8,0.8,1.0},        /* scale                */
  106.     40,                /* declasse               */
  107. };
  108. model magnesium = {
  109.     &calcium,            /* next model segment          */
  110.     NULL,            /* child model segments        */
  111.     NULL,            /* geometry compiled yet?      */
  112.     (Object)&magnesium,        /* compiled geometry object Id */
  113.     pebblePoints,        /* point dictionary            */
  114.     pebbleVertices,        /* polygon descriptions        */
  115.     {0,0,0},            /* centroid                */
  116.     MAGNESIUM_COLOR,        /* color                       */
  117.     PEBBLE_TEXTURE,        /* texture                     */
  118.     FALSE,            /* outlined                    */
  119.     {0,0,0},            /* rotation                    */
  120.     {50,250,0},            /* translate                */
  121.     {0.9,0.9,1.0},        /* scale                */
  122.     63,                /* declasse               */
  123. };
  124. model phosphorous = {
  125.     &magnesium,            /* next model segment          */
  126.     NULL,            /* child model segments        */
  127.     NULL,            /* geometry compiled yet?      */
  128.     (Object)&phosphorous,    /* compiled geometry object Id */
  129.     pebblePoints,        /* point dictionary            */
  130.     pebbleVertices,        /* polygon descriptions        */
  131.     {0,0,0},            /* centroid                */
  132.     PHOSPHOR_COLOR,        /* color                       */
  133.     PEBBLE_TEXTURE,        /* texture                     */
  134.     FALSE,            /* outlined                    */
  135.     {0,0,0},            /* rotation                    */
  136.     {250,50,0},            /* translate                */
  137.     {1.2,1.2,1.0},        /* scale                */
  138.     70,                /* declasse               */
  139. };
  140. model granite = {
  141.     &phosphorous,        /* next model segment          */
  142.     NULL,            /* child model segments        */
  143.     NULL,            /* geometry compiled yet?      */
  144.     (Object)&granite,        /* compiled geometry object Id */
  145.     pebblePoints,        /* point dictionary            */
  146.     pebbleVertices,        /* polygon descriptions        */
  147.     {50,-200,0},        /* centroid                */
  148.     GRANITE_COLOR,        /* color                       */
  149.     PEBBLE_TEXTURE,        /* texture                     */
  150.     FALSE,            /* outlined                    */
  151.     {0,0,0},            /* rotation                    */
  152.     {50,-200,0},        /* translate                */
  153.     {1.3,1.3,1.5},        /* scale                */
  154.     77,                /* declasse               */
  155. };
  156. model mica = {
  157.     &granite,            /* next model segment          */
  158.     NULL,            /* child model segments        */
  159.     NULL,            /* geometry compiled yet?      */
  160.     (Object)&mica,        /* compiled geometry object Id */
  161.     pebblePoints,        /* point dictionary            */
  162.     pebbleVertices,        /* polygon descriptions        */
  163.     {-150,-50,0},        /* centroid                */
  164.     MICA_COLOR,            /* color                       */
  165.     PEBBLE_TEXTURE,        /* texture                     */
  166.     FALSE,            /* outlined                    */
  167.     {0,0,0},            /* rotation                    */
  168.     {-150,-50,0},        /* translate                */
  169.     {1.3,1.3,1.5},        /* scale                */
  170.     80,                /* declasse               */
  171. };
  172.  
  173. model *stones[] = {
  174.     &mica,
  175.     &granite,
  176.     &phosphorous,
  177.     &magnesium,
  178.     &calcium,
  179. };
  180.  
  181.